<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模板渲染</title>
    <meta name="csrf-token" content="{{csrf}}">
    <!--<link rel="stylesheet" href="/releaseTool/build/styles.css">-->
</head>
<body>
<div id="app">
    我是渲染laravel php 后台数据的模板:<br>
    下面是数据：<br>
    {{words}}
    <br>
    {{csrf}}
    <br>
    <button class="testApi">点我</button>
</div>

<script   src="https://code.jquery.com/jquery-2.2.4.js"   integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="   crossorigin="anonymous"></script>
<script>
    $(function () {
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $(".testApi").click(function (e) {
            $.post('/api2/ajax',null, function (data) {
                alert(data.words);
            })
        });
    });
</script>

</body>
</html>